Page({
  data: {
    isLike: true,
    // banner
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔,3s
    duration: 1000,//	滑动动画时长1s
    imgUrls: [
      'https://img11.360buyimg.com/n1/jfs/t1/24995/6/22179/163456/66bc4207F845335ad/e0057d35f4293b1a.png',
      'https://img11.360buyimg.com/n1/jfs/t1/193431/24/25310/199710/629854f3E4c172af7/a0d6114f1485e6bc.jpg',
      'https://img11.360buyimg.com/n1/jfs/t1/91803/19/31957/33507/6372ffa3E3a57fde7/afb125bc3dd6c86d.jpg',
      'https://img11.360buyimg.com/n1/jfs/t1/55805/8/17178/179293/6298547cE2ccc010b/d3e5f50271e444c2.jpg',
      'https://img11.360buyimg.com/n1/jfs/t1/53897/28/24732/99144/6697a006F18bd409a/d9846eaeb01d9a5e.jpg'
    ],


    // 商品详情介绍
    detailImg: [
      "https://img30.360buyimg.com/sku/jfs/t1/102387/16/30911/153042/62d7a81aE41c58d2c/b088cd76c76bfffb.jpg",
      "https://img30.360buyimg.com/sku/jfs/t1/11806/17/18301/39732/62d7a819E7a70021f/55d8278adb60ced1.jpg",
      "https://img30.360buyimg.com/sku/jfs/t1/61755/2/21639/66373/6306f062E64c0bcc2/9597a08b0b9acbfd.jpg",
      "https://img30.360buyimg.com/sku/jfs/t1/183095/29/27392/230668/62d7a81aE87f1949a/febef0ab6f0b41fe.jpg",
      "https://img30.360buyimg.com/sku/jfs/t1/15225/36/18374/190434/62d7a81aEb11e29b1/39234151ae9f4ffe.jpg",
      "https://img30.360buyimg.com/sku/jfs/t1/103535/35/31396/110098/62d7a81aEaccdec8b/3f30a058d75b054d.jpg",
    ],
  },
  //预览图片
  onLoad() {
    console.log(this.data.imgUrls); // 检查数据是否正常
  },
  previewImage(e) {
    wx.previewImage({
      current: e.currentTarget.dataset.src,
      urls: this.data.imgUrls

    })
  },
  // 收藏
  addLike() {
    this.setData({
      isLike: !this.data.isLike
    });
  },
  // 跳到购物车
  toCar() {
    wx.switchTab({
      url: '/pages/cart/cart'
    })
  },
  // 立即购买
  immeBuy() {
    wx.showToast({
      title: '购买成功',
      icon: 'success',
      duration: 2000
    });
  },
})
